namespace Crux.Core.MethodEx;
/// <summary>
/// DynamicIlGetterCache
/// </summary>
public class DynamicIlGetterCache
{
    /// <summary>
    ///
    /// </summary>
    private readonly ConcurrentDictionary<Type, DynamicGetter> _state = new();
    /// <summary>
    ///
    /// </summary>
    /// <param name="type"></param>
    /// <param name="name"></param>
    /// <returns></returns>
    public DynamicGetter FromCache(Type type, string name) => _state.GetOrAdd(
      type, t => DynamicGetterFactory.CreateUsingIl(t.GetProperty(name)));

}